package com.wzy.mall.web.servlet.admin;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/admin/goods/*")
public class GoodsServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String requestURI = request.getRequestURI();
        String action = requestURI.replace("/api/admin/goods/", "");
        //System.out.println(action);
        if("getType".equals(action)) {
            Goods.getType(request, response);

        } else if("getGoodsByType".equals(action)) {
            Goods.getGoodsByType(request, response);

        } else if("addType".equals(action)) {
            Goods.addType(request, response);

        } else if("deleteType".equals(action)) {
            Goods.deleteType(request, response);

        } else if("imgUpload".equals(action)) {
            Goods.imgUpload(request, response);

        } else if("getGoodsInfo".equals(action)) {
            Goods.getGoodsInfo(request, response);

        } else if("deleteSpec".equals(action)) {
            Goods.deleteSpec(request, response);

        } else if("addSpec".equals(action)) {
            Goods.addSpec(request, response);

        } else if("deleteGoods".equals(action)) {
            Goods.deleteGoods(request, response);

        } else if("updateGoods".equals(action)) {
            Goods.updateGoods(request, response);

        } else if("addGoods".equals(action)) {
            Goods.addGoods(request, response);

        } else if("noReplyMsg".equals(action)) {
            Goods.noReplyMsg(request, response);

        } else if("repliedMsg".equals(action)) {
            Goods.repliedMsg(request, response);

        } else if("reply".equals(action)) {
            Goods.reply(request, response);

        }

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
